<?php
header('Content-Type:text/html;charset=utf-8');
$dbname="lilishop";
include("../../myzhuaqu.php");
include("jsondecode_inc.php");
//订单

$sql="select * FROM lilishop.li_order where sn='O202112131470273912699879425'";
$order=query($sql);



for($o=0;$o<count($order);$o++) {
    //对应帐单
    $sql="select * FROM lilishop.li_bill where sn='{$order[$o]['sn']}'";
    $order[$o]['bill']=query($sql);

    //会员基本资料
    $sql="select nick_name,sex,region,country,email,birthday,face,have_store,store_id,mobile FROM lilishop.li_member where id='{$order[$o]['member_id']}'";
    $order[$o]['member']=getrow($sql);

    //会员地址
    $sql="select NAME,email,mobile,alias,consignee_address_path,country,detail,area_code FROM lilishop.li_member_address where member_id='{$order[$o]['member_id']}'";
    $order[$o]['member']['address']=getrow($sql);

    //子订单
    $sql = "select * FROM lilishop.li_order_item where order_sn='{$order[$o]['sn']}'";
    $item = query($sql);
    $order[$o]['item']=$item;
    for ($i = 0; $i < count($item); $i++) {
        //规格
        $sql = "select * FROM lilishop.li_goods_sku where id='{$order[$o]['item'][$i]['sku_id']}'";
        $sku = query($sql);
        $order[$o]['item'][$i]['sku']= $sku;
    }
}
$data['order']=$order;
print_r(json_encode($data));


?>